<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>currentStyle</title>
    <script type="text/javascript">
        window.onload=function () {
            document.getElementById("btn1").onclick = function () {
                var op = document.getElementById("p1");
                var ocurrentStyle=null;
                if (op.currentStyle) {
                    ocurrentStyle = op.currentStyle;
                }
                else {
                    ocurrentStyle = window.getComputedStyle(op, null);
                }
                alert(ocurrentStyle.fontSize)
            }
        }
    </script>
    <style type="text/css">
        #p1{font-size:18px;
        color: red;}
    </style>
</head>
<body>
<p id="p1">这是一些文本</p>
<input type="button" id="btn1" value="段落字体">
</body>
</html>